<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>${constants.getSystemName()}</title>
    <link rel="stylesheet" href="${ctxPath}/assets/common/libs/layui/css/layui.css?v=${constants.getReleaseVersion()}"/>
    <link rel="stylesheet" href="${ctxPath}/assets/common/module/admin.css?v=${constants.getReleaseVersion()}"/>
    <link rel="stylesheet" href="${ctxPath}/assets/expand/css/style.css?v=${constants.getReleaseVersion()}" media="all"/>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15" >
        <div class="layui-col-lg6">
            <div class="layui-card">
                <div class="layui-card-body">
                    <div id="info logs" style="width: 100%;min-height:300px"></div>
                </div>
            </div>
        </div>
        <div class="layui-col-lg6">
            <div class="layui-card">
                <div class="layui-card-body">
                    <div id="error logs" style="width: 100%;min-height:300px"></div>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-row layui-col-space15" >
        <div class="layui-col-lg4">
            <div class="layui-card">
                <div class="layui-card-body">
                    <div id="warn logs" style="width: 100%;min-height:300px"></div>
                </div>
            </div>
        </div>
        <div class="layui-col-lg4">
            <div class="layui-card">
                <div class="layui-card-body">
                    <div id="debug logs" style="width: 100%;min-height:300px"></div>
                </div>
            </div>
        </div>
        <div class="layui-col-lg4">
            <div class="layui-card">
                <div class="layui-card-body">
                    <div id="trace logs" style="width: 100%;min-height:300px"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- js部分 -->
@/* 加入contextPath属性和session超时的配置 */
<script type="text/javascript">
    var Feng = {
        ctxPath: "${ctxPath}",
        version: '${constants.getReleaseVersion()}'
    };
</script>
<script type="text/javascript" src="${ctxPath}/assets/common/libs/layui/layui.js?v=${constants.getReleaseVersion()}"></script>
<script type="text/javascript" src="${ctxPath}/assets/common/js/common.js?v=${constants.getReleaseVersion()}"></script>
<script src="${ctxPath}/assets/common/libs/echarts/echarts.min.js?v=${constants.getReleaseVersion()}"></script>
<script src="${ctxPath}/assets/common/libs/echarts/echartsTheme.js?v=${constants.getReleaseVersion()}"></script>
<script src="${ctxPath}/assets/common/js/echartInit.js?v=${constants.getReleaseVersion()}"></script>
<script>
    layui.use(['layer','HttpRequest'], function () {
        const $ = layui.jquery;
        let HttpRequest = layui.HttpRequest;
        const levels = ["info","error","warn","debug","trace"]
        const logbackUrl = "/view/monitor/getLogbackInfo";
        for (let i=0;i<levels.length;i++){
            let level = levels[i];
            let request = new HttpRequest(logbackUrl, 'get',function (data){
                console.log(data)
                let echartsParams = {
                    id: level+" logs",
                    metric: data.logback_events_total
                }
                initGraph(echartsParams);
            })
            request.dataObject = {
                level: level,
                isRate: 'irate',
                rateMetric: 'logback_events_total',
                timeInterval: '[5m]'
            };
            request.setAsync(true);
            request.start();
        }
    });
</script>
</body>
</html>